<div id="quick_search_content">
	<?php if('DONE'==$request): ?>
	<?php foreach($data as $goods): ?>
	<div class="each" main-goods-id="<?php echo $goods->main_goods_id ?>">
		<input type="hidden" class="taobao_info" value='<?php echo $goods->taobao_info ?>' />
		<div class="image"><img src="" /></div>
		<div class="info">
			<div class="number"><span class="text">货号</span><br /><span class="span"><?php echo $goods->number ?></span></div>
			<div class="search_code"><span class="text">厂家货号</span><br /><span class="span"><?php echo $goods->search_code ?></span></div>
			<div class="url"><a href="javascript:void(0)" target="_blank">淘宝链接</a></div>
		</div>
	</div>
	<?php endforeach ?>
	<?php else: ?>
	<p class="error">呃，搜索空空哦:P</p>
	<?php endif ?>
</div>
<script type="text/javascript">
//淘宝信息赋值
$main_goods = $('#quick_search_content .each');
$main_goods.mouseenter(function(){
	$(this).css('background', '#eee');
}).mouseleave(function(){
	$(this).removeAttr('style');
})
$main_goods.each(function(){
	$this = $(this);
	taobao_info = tool.toJson($this.find('.taobao_info').val());
	if ('' != taobao_info.image)
	{
		$this.find('.image img').attr('src', taobao_info.image);
	}
	if ('' != taobao_info.url)
	{
		$this.find('.info a').attr('href', taobao_info.url);
	}
	else
	{
		$this.find('.info a').hide();
	}
});
//绑定货物事件
if ($main_goods.length > 0)
{
	$main_goods.children('.image').unbind('click').bind('click', function(){
		$this = $(this);
		main_goods_id = $this.parents('.each').attr('main-goods-id');
		url = site.url + 'ajax/quick_search';
		json = tool.toJson('{"goods_type":"sg","q":"'+main_goods_id+'"}');
		$.post(url, json, function(dom){
			//dom为获得返回的对象
			image		 = $this.find('img').attr('src');
			goods_number = $this.next().find('.number span.span').text();
			search_code	 = $this.next().find('.search_code span.span').text();
			$obj = $(dom);
			$obj.prepend('<div class="goods-info"><div class="image"><img src="'+image+'" /></div><div class="number">货号<br />'+goods_number+'<br />厂家货号<br />'+search_code+'</div><div class="clear"></div></div>');
			tool.jump_box.init($obj);
			style.highline($obj.find('.each'), '#ddd');
		});
	})
}
</script>